﻿using A.M.ETO;
using A.M.Storage.Application;
using A.M.Storage.I_Infrastruecure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Threading.Tasks;
using W.M.Materiel.Application.IServices;
using W.M.Materiel.Domain.Entity;
using W.M.Materiel.Infrastruecure.IRepository;

namespace W.M.Materiel.Application.Services
{
    public class Finished_products_tableServices : BaseServices<finished_products_table, string>, IFinished_products_tableServices
    {
        private readonly IFinished_products_tableRepository finished_Products_TableRepository;

        public Finished_products_tableServices(IFinished_products_tableRepository finished_Products_TableRepository) : base(finished_Products_TableRepository)
        {
            this.finished_Products_TableRepository = finished_Products_TableRepository;
        }

        /// <summary>
        /// 显示成品类型
        /// </summary>
        /// <returns>统一返回格式</returns>
        public async Task<ApiReturn<finished_products_table>> GetFinished_products_table()
        {
            ApiReturn<finished_products_table> apiReturn = new ApiReturn<finished_products_table>();

            var list = await finished_Products_TableRepository.GetShowQueryableAsync();

            apiReturn.Code = 200;
            apiReturn.ListInfor = list.Select(x => new finished_products_table
            {
                product_type_id = x.product_type_id,
                product_type_name = x.product_type_name,
            }).ToList();
            return apiReturn;
        }
    }
}
